<script src="$!{form.domain}/js/jquery.js" type="text/javascript" ></script>
<!--顶部菜单-->
<div class="page-top">
  <div class="c-container clearfix">
    <div class="floatleft"> <a class="link6 pr45" href='$!{form.domain}/' target="_blank" title="首页">首页</a> <a class="link6 pr45" href='javascript:void(0);' title="客户端下载">客户端下载</a> <a class="link6" href="$!{form.domain}/intro/about.html">关于我们</a> </div>
    <div class="floatright">
      <span class="loginandout"> <a id="login_status" href='$!{form.domain}/member/login' class="link1">登录</a> </span>&nbsp; 
      <span class="loginandout"><a id="register_or_logout" href='$!{form.domain}/member/register' class="link1">注册</a></span>&nbsp;
      |&nbsp; <a class="link6" onclick="AddFavorite(window.location,document.title);" href="javascript:;">收藏</a> </div>
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){
	var _url='$!{form.domain}/member/user-cache';
	jQuery.ajax({
		type: "GET",
		url: _url,
		dataType: "json",
		async:false,
		success: function(data){
			if(data && data.drmUser && data.drmUser.m && data.drmUser.u){
				$("#login_status").attr("href", "#");
				$("#login_status").html(data.drmUser.m);
				$("#register_or_logout").parent().after("&nbsp;<span class='loginandout'> <a href='http://space.zhuclass.com/#/"+data.drmUser.u+"/home' class='link1'>我的空间</a></span>")
				.after("&nbsp;<span class='loginandout'><a href='http://study.zhuclass.com/' class='link1'>学习平台</a></span>");
				$("#register_or_logout").attr("href", "$!{form.domain}/member/logout");
				$("#register_or_logout").html("退出");
			}
		}
	})
})


function AddFavorite(sURL, sTitle) {
	try {
		window.external.addFavorite(sURL, sTitle);
	} catch (e) {
		try {
			window.sidebar.addPanel(sTitle, sURL, "");
		} catch (e) {
			alert("加入收藏失败，请使用Ctrl+D进行添加");
		}
	}
}

function SetHome(obj, vrl) {
	try {
		obj.style.behavior = 'url(#default#homepage)';
		obj.setHomePage(vrl);
	} catch (e) {
		if (window.netscape) {
			try {
				netscape.security.PRivilegeManager.enablePrivilege("UniversalXPConnect");
			} catch (e) {
				alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'");
			}
			var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
			prefs.setCharPref('browser.startup.homepage', vrl);
		}
	}
}
</script>